<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>


  <script>
    const url = "https://eloquentjavascript.net/author";
    const types = ["text/plain",
      "text/html",
      "application/json",
      "application/rainbows+unicorns"];

    async function showTypes() {
      for (let type of types) {
        let resp = await fetch(url, { headers: { accept: type } });
        console.log(`${type}: ${await resp.text()}\n`);
      }
    }

    showTypes();
  </script>
</body>

</html>